package pl.edu.agh.pros.conf;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public final class XMPPConfiguration {

	private String xmppServerAddress;
	private int xmppServerPort;
	private String xmppRoomServiceName;

	private String xmppUsername;
	private String xmppPassword;

	public XMPPConfiguration() {
	}

	public XMPPConfiguration(String xmppServerAddress, int xmppServerPort, String xmppRoomServiceName) {
		super();
		this.xmppServerAddress = xmppServerAddress;
		this.xmppServerPort = xmppServerPort;
		this.xmppRoomServiceName = xmppRoomServiceName;
	}

	public XMPPConfiguration(String xmppServerAddress, int xmppServerPort, String xmppRoomServiceName,
			String xmppUsername, String xmppPassword) {
		super();
		this.xmppServerAddress = xmppServerAddress;
		this.xmppServerPort = xmppServerPort;
		this.xmppRoomServiceName = xmppRoomServiceName;
		this.xmppUsername = xmppUsername;
		this.xmppPassword = xmppPassword;
	}

	@XmlElement
	public String getXmppServerAddress() {
		return xmppServerAddress;
	}

	public void setXmppServerAddress(String xmppServerAddress) {
		this.xmppServerAddress = xmppServerAddress;
	}

	@XmlElement
	public int getXmppServerPort() {
		return xmppServerPort;
	}

	public void setXmppServerPort(int xmppServerPort) {
		this.xmppServerPort = xmppServerPort;
	}

	@XmlElement
	public String getXmppRoomServiceName() {
		return xmppRoomServiceName;
	}

	public void setXmppRoomServiceName(String xmppRoomServiceName) {
		this.xmppRoomServiceName = xmppRoomServiceName;
	}

	@XmlElement
	public String getXmppUsername() {
		return xmppUsername;
	}

	public void setXmppUsername(String xmppUsername) {
		this.xmppUsername = xmppUsername;
	}

	@XmlElement
	public String getXmppPassword() {
		return xmppPassword;
	}

	public void setXmppPassword(String xmppPassword) {
		this.xmppPassword = xmppPassword;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((xmppPassword == null) ? 0 : xmppPassword.hashCode());
		result = prime * result + ((xmppServerAddress == null) ? 0 : xmppServerAddress.hashCode());
		result = prime * result + xmppServerPort;
		result = prime * result + ((xmppUsername == null) ? 0 : xmppUsername.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		XMPPConfiguration other = (XMPPConfiguration) obj;
		if (xmppPassword == null) {
			if (other.xmppPassword != null)
				return false;
		} else if (!xmppPassword.equals(other.xmppPassword))
			return false;
		if (xmppServerAddress == null) {
			if (other.xmppServerAddress != null)
				return false;
		} else if (!xmppServerAddress.equals(other.xmppServerAddress))
			return false;
		if (xmppServerPort != other.xmppServerPort)
			return false;
		if (xmppUsername == null) {
			if (other.xmppUsername != null)
				return false;
		} else if (!xmppUsername.equals(other.xmppUsername))
			return false;
		return true;
	}

}
